Distant Lands

  Main Menu

· Home
· About DL
· Roleplaying
· Library
· Forums
· Art Gallery
· Photo Gallery
· Links
· Online Help

· Play Now!



What is a DL Dynamic?

Only Staff have the ability to create dynamics, and even then only on the
build server.

DL macros have the ability create dynamic objects that allow you, as a builder,
to interact with players on a whole new level. Currently you can create dynamic
macros, sources, targets, triggers, variables, and lists. Errrr... ok, what does
that mean?? It really isn't all that difficult. Here's the basic concept:

We have these great macros that can automate all kinds of tasks, but there isn't
a way to make them really interactive -- there is no way to make them react to
a player, for example.

All dynamic objects are only in existance while they are being used by a macro.
Nearly as soon as the macro terminates, all dynamic objects associated with that
macro are automatically removed. When you play one macro from another macro,
they share the same context and have access to all the same dynamics that have
been created.

Now would be a good time to tell you that generally, macro recording, especially
longer macros that use dynamics, is easiest to work with outside of Distant Lands
in an editor like notepad. At least know that when you edit macros within the
game and you step through them to change dynamics around, it may not react to your
command as you'd expect, that does not mean the macro will not execute correctly.
It is because the previous dynamic commands did not get executed. If this happens,
you should verify that your changes look right (macro show) and then save the
changes and see if it works correctly. Generally, the easiest way to make sure
this doesn't happen to you is to write your macros in an external editor. Start
recording the macro and save one command in it (any command will do -- I like to
smile). At that point you've got your library and macro number, at the top of
your notepad do something like:

macro 1 1 edit
macro unrecord *

That way when you paste this in, it will automatically go into the editor and
delete all of the macros current contents. Then just cut and paste your entire
macro after each edit you want to implement.

So you probably already have a fair idea of what a dynamic macro is...
essentially a macro within a macro -- a macro recorded when its parent macro
is played.

Use dynamic sources for things that need to be matched in order to start a macro.

Use dynamic targets to specify who the macro should be executed on.

Use dynamic triggers to tie it all (dynamic macro, sources and targets) together.

Use dynamic variables to make your life a good deal easier - think text replacement.

Use dynamic lists useful for sequential tracking of information and text replacement.

And now, the nitty gritty details and break down of the dynamics command
(which can also be referenced by a * as a shortcut, as shown below).

To view all existing dynamics during the recording process:

> *

Because dynamic variables make life easier, we'll cover them first.

To view existing dynamic variables in your current recording:

> * variables

To copy a dynamic variable to a new variable name:

> * variable copy <from_name> <to_name> 

To create a new dynamic variable: 
 
> * variable create <name> <string contents of the variable> 
 
To delete a dynamic variable: 
 
> * variable delete <name> 
 
To change a dynamic variable name: 
 
> * variable move <from_name> <to_name> 
 
To update the contents of a dynamic variable: 
 
> * variable update <name> <new string contents of the variable> 

So why would you want to create variables?  Well, in one case, you can take 
advantage of variables without even creating them -- system variables. System 
variables are variables that the system automatically populates when you issue 
a command. Such as putting the number of the dynamic source that is created 
into the variable SOURCE.  System variables are all upper case, user variables 
are all lower case. You reference variables in your macros with the name of 
the variable surrounded by :: so if your variable is named my_npc you would 
reference it with :my_npc: in the macro. So to reference the system variable 
that contains the number of the last source created we'd use :SOURCE: in our 
macro, perhaps like so: 
 
> * source create 
> * source :SOURCE: auto reset 
 
Because dynamic lists are really a specialized type of variable, we'll
cover them next.

To view existing dynamic lists in your current recording:

> * lists

To copy a dynamic list to a new list name (this populates the system
variable LIST with the number of the new list created):

> * list <list #> copy <to_name>

To create a new dynamic list (this also populates the system variable
LIST with the number of the new list created, which you'll typically
want to store in a variable):

> * list create <list_name>

To delete a dynamic list:

> * list <list #> delete

To change a dynamic list name:

> * list <list #> rename <to_list_name>

To create a new member in an existing dynamic list (note that the entry
can be any string of characters up until you hit enter and the system
variable LIST_MEMBER contains this entry after the command has been
executed):

> * list <list #> member create <entry for member>

To copy an existing member in a dynamic list:

> * list <list #> member <member #> copy <to member #>

To insert a new member into a specific place in a dynamic list:

> * list <list #> member <member #> insert <entry for member>

To remove a member in a dynamic list:

> * list <list #> member <member #> remove

To update an existing member in a dynamic list:

> * list <list #> member <member #> update <entry for member>

Much like variables, you can directly access the contents of a dynamic
lists' members, instead of using :: you utilize (list #.member #) so to
make a character running a macro say whatever is in list 1 member 1 and
list 1 member 2, you'd use the following:

> say Hello (1.1), I haven't seen you since (1.2).

Also, you can step through the members of a list using the each
command (see help macros).

There are 4 different lists that can be automatically created for you
by the system, all four return a list of UIDs for the matching targets.

To create a list of the equipment currently being worn by the character
the macro is currently being played upon:

> * list auto equipment <list_name>

To create a list of the inventory currently being carried by the character
the macro is currently being played upon:

> * list auto inventory <list_name>

To create a list of the items in the room with the character the macro
is currently being played upon:

> * list auto items <list_name>

To create a list of the people in the room with the character the macro
is currently being played upon:

> * list auto people <list_name>

Dynamic variables and lists are especially useful for situations where
something is repeated in multiple locations. For example, if you wrote
a macro that requires the NPC to interact with a player and you have to
reference that NPC multiple place in the macro (or you want to make it
so the macro can be called from another macro which determines the NPC),
you could create a dynamic variable with the NPC's virtual number in it
and then just reference the dynamic variable:

> * variable create my_npc 7
> spawn :my_npc:
> spawn :my_npc:

A short macro like this one would spawn (load) 2 of NPC #7 (a dog).

You can create multiple dynamic macros within a macro, but you can only record
one at a time. The command structure is very similar to regular macros, except
for the dynamic command in front and the optional quiet recording (which makes
it so that none of the commands are executed during the recording phase of the
dynamic macro -- what you'll typically want, at least when you are done
troubleshooting).

To play a dynamic macro from a macro (or use the play dynamic command):

> * macro <macro #>

You probably shouldn't need it, but if you want to delete a dynamic macro
for some reason:

> * macro <macro #> delete

While you are recording a macro (if you aren't in quiet mode) you can
view the content of your dynamic macro recording):

> * macro <macro #> show {nopage}

To play a dynamic macro from a macro on an optional victim (or use
the play dynamic command):

> * macro <macro #> play <victim>

To start or stop (* macro record) recording a dynamic macro (using
the quiet keyword will make it record commands in the macro without executing
each command -- this should be used in most situations):

> * macro record {quiet} <macro name>

To determine when a macro should be played, dynamic sources are used.
If more than 1 source is used in a trigger source map, all sources in the map
must be matched for the trigger to play the macro on the target.

To view existing dynamic sources while recording a macro:

> * sources <source #>

In order to use a dynamic source, you must first create it (this populates
the system variable SOURCE with the number of the dynamic source created):

> * source create

In order to delete a dynamic source (which you generally shouldn't need to do):

> * source <source #> delete

If you are using a source that is a character (PC or NPC) and a command,
you can specifiy specific arguments for the command, though much like with
sources, you need to create each dynamic source argument individually
(this command populates the system variable SOURCE_ARG with the number of
the dynamic source argument created):

> * source <source #> argument create

To delete a dynamic source argument:

> * source <source #> argument <argument #> delete

In order for a dynamic source with arguments to match, only 1 of the arguments
of the source must match. You can create dynamic source arguments that use keywords
to match commands like say or mutter which have free form arguments that
are typically just words:

> * source <source #> argument <argument #> keywords <keywords for argument>

You can also optionally specify which of the keywords need to match:

> * source <source #> argument <argument #> all {keywords}
> * source <source #> argument <argument #> any {keywords}
> * source <source #> argument <argument #> exact {keywords}
> * source <source #> argument <argument #> no {keywords}
> * source <source #> argument <argument #> ordered {keywords}

Directions, exits, yes, no, on, off, characters and even items can generally be
matched upon for a command that these arguments.  For example, point allows
you to point at an item, in a direction or at a character -- these would all be
good examples of potential source arguments.

> * source <source #> argument <argument #> direction <direction | [ any ]>
> * source <source #> argument <argument #> exit <exit | [ any ]>
> * source <source #> argument <argument #> item <# | [ any ]>
> * source <source #> argument <argument #> no
> * source <source #> argument <argument #> npc <# | [ any ]>
> * source <source #> argument <argument #> number <# | [ any ]>
> * source <source #> argument <argument #> off
> * source <source #> argument <argument #> on
> * source <source #> argument <argument #> pc <name | # | [ any ]>
> * source <source #> argument <argument #> uid <UID>
> * source <source #> argument <argument #> yes

It is also possible to specify a label that is associated with a particular
dynamic source argument. If the source argument matches (and there is not
a label on the target which would override the label on the source argument),
then when the macro or dynamic macro is triggered based upon that source, the
macro can reference the contents of the label using _l_ in the macro.

> * source <source #> arguments <argument #> label <label string>

By default sources are active when created, and then deactivated when they've
been used by a trigger.  To manually activate/deactivate a dynamic source:

> * source <source #> active

You can also specify the auto reset command (with an optional timer) to have
the source automatically reset once it has been used by a trigger:

> * source <source #> auto {reset} <# seconds>

You can specify which command(s) a character must type in to match the source
(if you enter the same command twice, it will remove the command previously added):

> * source <source #> command <command name>

You can specify a room a character must enter to match the source:

> * source <source #> enter [ room ] <#>

You can specify an item which must be in the room, being used or carried (depending
upon the keywords used):

> * source <source #> item <#> [ using | carrying ]

You can specify a group which a character must be in to match the source:

> * source <source #> group <#>

You can specify that a character must be in or out of combat in order to
meet the source criteria:

> * source <source #> combat {only}
> * source <source #> non-combat {only}

You can specify a non-player character or player character to be used for the
source matching criteria (this is necessary if you wish to associate source
commands and associated arguments):

> * source <source #> npc <# | [ all | any ]>
> * source <source #> pc <name | # | [ any | all ]>
> * source <source #> uid <UID>

You can limit source matching to a specific room:

> * source <source #> room <#>

You can specify that a character must be roleplaying in order to meet the
source criteria:

> * source <source #> rp {only}

You can specify that a task or quest or even a specific part within a task
or quest be part of the source matching criteria:

> * source <source #> quest <#>
> * source <source #> quest <#> part <#>
> * source <source #> task <#>
> * source <source #> task <#> part <#>

If you require some type of source that isn't implemented, there is a chance
it will be implemented as a special source. This just means it is implemented
in the code using a number instead of a name for easier expandability:

> * source <source #> special <#>

It is possible to have a source match based upon a timer:

> * source <source #> timer <# seconds | [ min | max ]>
> * source <source #> timer absolute [ dl | real ] <real time>
> * source <source #> timer dl <#> [ hours | days ]
> * source <source #> timer real <#> [ seconds | minutes | hours | days ]

Potentially you could even use a source of the weather:

> * source <source #> weather <#>

It is also possible to specify a label that is associated with a particular
dynamic source. If the source matches (and there is not a label on a source
argument or the target which would override the label on the source), then
when the macro or dynamic macro is triggered based upon that source, the
macro can reference the contents of the label using _l_ in the macro.

> * source <source #> label <label string>

Create dynamic targets to specify what character the macro should
be executed on.  If more than 1 target is used in a trigger target
map, all targets in the map that can be found have the macro played
on them.

To view existing dynamic targets while recording a macro:

> * targets <target #>

In order to use a target, you must first create it (this populates the system
variable TARGET with the number of the dynamic target created):

> * target create

In order to delete a dynamic target (which you generally shouldn't need to do):

> * target <target #> delete

By default targets are active when created, and unlike sources, they are not
automatically deactivated when they've been used by a trigger. To manually
activate/deactivate a dynamic target:

> * target <target #> active

You can specify that a character must be in or out of combat in order
to meet the target criteria:

> * target <target #> combat {only}
> * target <target #> non-combat {only}

You can specify that a character must be roleplaying in order to meet the
target criteria:

> * target <target #> rp {only}

You can specify a group as the target:

> * target <target #> group <#>

You can specify an item which will target the room it is in, or you
can target a character using or carrying the item (depending upon the
keywords used):

> * target <target #> item <#> [ using | carrying ]

It is also possible to specify a label that is associated with a particular
dynamic target. If the target matches, then when the macro or dynamic
macro is triggered upon that target, the macro can reference the contents
of the label using _l_ in the macro.

> * target <target #> label <label string>

If you want to exclude the primary source from possible targets:

> * target <target #> not source

You can specify a non-player character or player character to be used as
the macro target:

> * target <target #> npc <#> [ all | any ]
> * target <target #> pc <name | #> [ all | any ]
> * target <target #> uid <UID>

You can specify that the participants on a task or quest are the
designated target:

> * target <target #> quest <#> [ all | room ]
> * target <target #> task <#> [ all | room ]

You can specify that everyone in a room is the designated target:

> * target <target #> room <#>

Finally, we'll use dynamic triggers to tie it all (dynamic macro, sources
and targets) together by selecting a specific macro or command we wish to run
and many different possible combinations of sources and targets.  By using
dynamic trigger groups we can associate multiple triggers with one macro or
command. Additionally, the groups themselves have a few properties.

To view existing dynamic trigger groups:

> * triggers <group #>

In order to use a trigger group, you must first create it (this populates
the system variable TRIGGER_GROUP with the number of the dynamic trigger
group created):

> * triggers create <trigger group name>

By default triggers are active when created, and unlike sources, they are not
automatically deactivated when they are used. To manually activate/deactivate
a dynamic trigger group:

> * triggers <group #> active

In order to use a trigger, you must first create it (this populates the
system variable TRIGGER with the number of the dynamic trigger created):

> * triggers <group #> create

In order to delete a dynamic trigger group (which you generally shouldn't
need to do):

> * triggers <group #> delete

If you wish to use a command instead of a macro when the trigger is set
off use the following:

> * triggers <group #> command <command>

If you wish to use a macro instead of a command when the trigger is set
off use the following (no macro library # is needed for dynamic macros):

> * triggers <group #> macro {dynamic} <macro library #> <macro #>

It is also possible to specify a label that is associated with a particular
dynamic trigger group. If the trigger group is match and a command or
macro is issued to a character and no other labels have been matched during
this process, then the macro can reference the contents of the label using
_l_ in the macro.

> * triggers <group #> label <label string>

To change the name on a dynamic trigger group:

> * triggers <group #> name <trigger group name>

By default triggers are active when created, and unlike sources, they are not
automatically deactivated when they are used. To manually activate/deactivate
a dynamic trigger within a trigger group:

> * triggers <group #> trigger <trigger #> active

In order to delete a dynamic trigger (which you generally shouldn't need to do):

> * triggers <group #> trigger <trigger #> delete

If multiple triggers within a group match the criteria you can do some
crude load balance of them using a feature similar to mob action frequencies.
Essentially, all matching frequencies are added up and then turned into a
percentage.

> * triggers <group #> trigger <trigger #> frequency <0 - 100>

It is also possible to specify a label that is associated with a particular
dynamic trigger within a trigger group. If the trigger is selected (and there
is not a label on a source, source argument or the target which would override
the label on the trigger), then when the macro or dynamic macro is triggered
based upon that trigger, the macro can reference the contents of the label
using _l_ in the macro.

> * triggers <group #> trigger <trigger #> label <label string>

If multiple triggers within a group match the criteria you can specify
a higher priority to attempt to match specific triggers first.

> * triggers <group #> trigger <trigger #> priority <0 - 20>

In order to use source macro substitution, you must specify the primary
source for the trigger:

> * triggers <group #> trigger <trigger #> primary {source} <source #>

By providing the primary source, if the source is an item or character,
the following substitions are automatically performed within a macro:

source name - Available to macro as _n_
source name first word only - Available to macro as _n1_
source name first and second words only - Available to macro as _n2_
source short_description - Available to macro as _s_
source type - Available to macro as _t_
source id (vnum) - Available to macro as _i_
source uid (unique id) - Available to macro as _u_

This all works similar to labels:

Label Order (last match with label is used):
trigger group, trigger, source, source argument, target

label - Available to macro as _l_

This allows you to have macros that react to the source such as a macro
that smiles at the primary source:

> smile _n1_

To specify which sources must match for a trigger to be selected (all
sources -- including primary if provided -- must match):

> * triggers <group #> trigger <trigger #> source {map} <source map>

To specify which targets must match for a trigger to be selected (any
targets -- all will be tried -- will match):

> * triggers <group #> trigger <trigger #> target {map} <target map>

See Also:  Macros
Back to Distant Lands Help Help Master Keyword Index List
  Recent Posts

 
  W3C Validation
Valid XHTML 1.0 Strict Valid CSS!

Website layout and design by .
DHTML Menu By Milonic JavaScript